package com.zja.model;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;

/**
 * @author JA
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
//replies不参与ToString，防止出现递归死循环
@ToString(exclude = "replies")
public class Comment {
    private Long id;
    private String content;
    private Long articleId;
    private Long userId;
    private Long parentCommentId;
    private Timestamp createdAt;
    private Timestamp updatedAt;

    //用于构建评论树
    private List<Comment> replies = new ArrayList<>();
}
